<?php $this->_extends('../_layouts/blank_layout'); ?>

<?php $this->_block('contents'); ?>

<div id="getting-started" alt="用户管理">
<?php
// user_id, group_id, account, user_name, password, ipzone, email, mobile, phone, join_day, dimission_day, birthday,
// created, updated, is_locked, register_ip, last_login, last_login_ip, login_count
// group_id, parent_id, group_name, left_value, right_value, description, has_users
	function cutdel($a){
		$allhave = array();
		$allr='';
		foreach ($a as $key => $value) {
			$allr.= $value['rolename'];
			array_push($allhave,$value['rolename']);
			//echo $s['groupid'];
		}
		if (in_array('ADMIN',$allhave)) {
            return true; // put package 1 first: package 2 depends on package 1
        }else
			return false;
	}



?>
<table>
    <tr>
        <th width="5">　</th>
        <th align="center" class='bgTitle' width="95">姓名</th>
        <th align="center" class='bgTitle'>用户组</th>
        <th align="center" class='bgTitle' width="95">操作</th>
    </tr>
  <?php foreach ($show_box['users'] as $value): ?>
    <tr class="<?php if(($countno+1)/2==ceil(($countno+1)/2)){echo 'tw';} ?>"><td align="center"><?php echo $countno++;?></td>
        <td align="center" width="95">
            <span title="登录帐号：<?php echo h($value->account); ?> 
登录次数：<?php echo h($value->login_count); ?>"><?php echo h($value->user_name); ?></span></td>
        <td align="center"><?php echo h($value->group->group_name); ?></td>
        <td align="center" width="95">
            <a href="<?php echo url('default::default/framework', array('user_id' => $value->id(),'space' => 'admin','control' => 'users','acts' => 'view|add')); ?>"><img src="images/icons/view.png"></a><a href="<?php echo url('default::default/framework', array('user_id' => $value->id(),'space' => 'admin','control' => 'users','acts' => 'resetpw|add')); ?>"><img src="images/icons/key.png"></a>
            <?php if(!cutdel($value->roles->toArray())): ?><a href="<?php echo url('default::default/framework', array('user_id' => $value->id(),'space' => 'admin','control' => 'users','acts' => 'edit|add')); ?>"><img src="images/icons/edit.png"></a>
            <a href="<?php echo url('default::default/framework', array('user_id' => $value->id(),'space' => 'admin','control' => 'users','acts' => 'del')); ?>" onclick="if(!confirm('确认删除吗？')){return false;}"><img src="images/icons/del.png"></a>
            <a href="<?php echo url('default::default/framework', array('user_id' => $value->id(),'space' => 'admin','control' => 'users','acts' => 'bind|add')); ?>"><img src="images/icons/users.png"></a><?php endif?>
            </td>
    </tr>
  <?php endforeach; ?>
<tr>
      <td colspan="4"><center>
       共有 <font color="Red"><?php echo $pager['record_count'];?></font> 条记录,分为 <font color="Red"><?php echo $pager['page_count'];?></font> 页显示,当前第 <font color="Red"><?php echo $pager['current'];?></font>页,每页 <font color="Red"><?php echo $pager['page_size'];?></font> 条<?php echo $pagestr; ?></center>
    </td>
    </tr>
</table>
  
</div>


<?php $this->_endblock(); ?>



